/**
 * Take a page argument
 * 
 */
	var system = require('system'),
	page = require('webpage').create(),
    env = system.env,
	args = system.args,
	pageUrl = args[0],
	nodes = [],
	depth = 0,
	marker = '-';

	var handler = function(){
		var body = document.body;
		(function( node ){
			depth++;
			if(node.hasChildNodes()){
				for( var i=0; i < node.childNodes.length; i++ ){
					arguments.callee(node.childNodes[i]);
				}
			}
			marker = '';
			for ( var j=0; j< depth; j++){
				marker += '-';
			}
			console.log(marker + ':' + node.id);
			depth--;
		})(body);
	}

	page.open(pageUrl, function (status) {
			if (status !== 'success') {
				console.log('Unable to open URL: ' + pageUrl);
			} else {
				
				page.evaluate(handler);
			}
	});
	
	phantom.exit();	